package agent;

import instanceXMLParser.Instance;
import aima.core.agent.Action;
import aima.core.agent.AgentProgram;
import aima.core.agent.Percept;
import aima.core.agent.impl.AbstractAgent;

public class DavideSpataroAgentHeuristicKBest extends AbstractAgent implements AgentProgram{

	VacuumAgentSolverHeuristicKBest solver;
	Instance i;
	int mossa=0;
	public DavideSpataroAgentHeuristicKBest(Instance i) {
		solver= new VacuumAgentSolverHeuristicKBest();
		this.i=i;
	}
	
	public DavideSpataroAgentHeuristicKBest(Instance i,int KBEST) {
		solver= new VacuumAgentSolverHeuristicKBest();
		solver.KBEST=KBEST;
		this.i=i;
	}
	
	
	
	
	@Override
	public Action execute(Percept p) {
		if(mossa==0){
			System.out.println("Sto risolvendo...");
			solver.solveFromInstance(i);
		}
		mossa++;
		return solver.solution.get(mossa-1);
	}

}
